package com.gcsoftware.authentications.helper;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by qs on 2018/3/14.
 */
public class AuthenticHelper {
    public static Map<String, String> getFilterChainDefinitionManager() {
        Map<String, String> filterChainDefinitionManager = new LinkedHashMap<String, String>();

        /*
        静态资源，登录页面等不需要验证
         */
        filterChainDefinitionManager.put("/login", "anon");
        filterChainDefinitionManager.put("/register", "anon");
        filterChainDefinitionManager.put("/register.html", "anon");
        filterChainDefinitionManager.put("/error/403.html", "anon");
        filterChainDefinitionManager.put("/error/404.html", "anon");
        filterChainDefinitionManager.put("/error/500.html", "anon");

        filterChainDefinitionManager.put("/commons/**","anon");

        filterChainDefinitionManager.put("/pwd-forget", "anon");
        filterChainDefinitionManager.put("/login.html", "anon");
        filterChainDefinitionManager.put("/favicon.ico", "anon");
        filterChainDefinitionManager.put("/logout", "logout");


        filterChainDefinitionManager.put("/static/**", "anon");
        filterChainDefinitionManager.put("/css/**", "anon");
        filterChainDefinitionManager.put("/js/**", "anon");
        filterChainDefinitionManager.put("/bootstrap/**", "anon");
        filterChainDefinitionManager.put("/images/**", "anon");
        filterChainDefinitionManager.put("/font/**", "anon");

        filterChainDefinitionManager.put("/getToken/**", "anon");

        filterChainDefinitionManager.put("/reset-pwd", "cauthc[ADMIN,USER]");
        filterChainDefinitionManager.put("/saveNewPassword", "cauthc");



        filterChainDefinitionManager.put("/enroll/**","roles[USER]");

        filterChainDefinitionManager.put("/**", "roles[ADMIN]");


//        filterChainDefinitionManager.put("/**", "anon");


        return filterChainDefinitionManager;
    }
}
